﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZhiAo.WebLib.Data;
using System.Data;
using ZhiAo.CoreLibrary;

namespace ZhiAo.CommonLibrary
{
    public class ECILanguage
    {
        private static ZhiAo.CoreLibrary.CommonLibrary cmn = new ZhiAo.CoreLibrary.CommonLibrary();
        /// <summary>
        /// 程序翻译
        /// </summary>
        /// <param name="code">编码</param>
        /// <returns></returns>
        public static string Read(string code)
        {
            try
            {
                string language = UserInfo2.Language;
                if (language == "") language = "CN";
                string sql = " SELECT " + language + " FROM ECI_LANGUAGE WHERE CODE = " + cmn.SQLQ(code) + " ";
                DataTable dt = DBHelper.GetDataTable(sql);
                if (cmn.CheckEOF(dt))
                {
                    return dt.Rows[0][0].ToString();
                }
                else
                {
                    return "";
                }
            }
            catch { return ""; }
        }


        /// <summary>
        /// 平台翻译
        /// </summary>
        /// <param name="code">编码</param>
        /// <returns></returns>
        public static string BaseReadA(string code)
        {
            try
            {
                string sql = " SELECT " + UserInfo2.Language + " FROM ECI_BASE_LANGUAGE WHERE CODE = " + cmn.SQLQ(code) + " ";
                DataTable dt = DBHelper.GetDataTable(sql);
                if (cmn.CheckEOF(dt))
                {
                    return dt.Rows[0][0].ToString();
                }
                else
                {
                    return "";
                }
            }
            catch { return ""; }
        }
    }
}
